package com.framework.Module.base.meet;

import com.framework.ACore.ModuleFields;
import com.framework.ACore.ModuleInfo;
import com.framework.ACore.ModuleTodo;
import com.framework.ACore.ModuleWhere;
import com.framework.Flow.FlowWhere;
import com.framework.Table.Table;


/**
 * 模块meet.会议
 * */
public class Tablemeet extends Table {

    /**
     * 正常会议
     * */
    public static int STATE_ZC = 0;

    /**
     * 会议中
     * */
    public static int STATE_ING = 1;

    /**
     * 结束
     * */
    public static int STATE_END = 2;

    /**
     * 取消
     * */
    public static int STATE_CANCEL = 3;


    protected void initTable() {
        setInfo("meet", "会议");

        String summary = "[{meethys}]{title}({startdt})";

        setModuleInfo(ModuleInfo.get()
                .setIsxt(2).setIstj(1)
                .setSummary(summary)
                .setImgurl("https://xinhu-1251238447.file.myqcloud.com/img/21714.png")
                .setType("基础")
        );

        addModuleFields(ModuleFields.get()
                .setName("主题")
                .setFields("title")
                .setType("varchar(100)")
                .setPlaceholder("会议主题")
                .setIsbt(1).setIsalign(ModuleFields.ALIGN_LEFT)
                .setIsss(1)
        );

        addModuleFields(ModuleFields.get()
                .setName("会议室")
                .setFields("meethys")
                .setType("varchar(100)")
                .setIsbt(1).setIspx(1)
                .setIsss(1)
        );

        addModuleFields(ModuleFields.get()
                .setName("参会人员")
                .setFields("recename")
                .setType("varchar(1000)")
                .setIsbt(1).setPlaceholder("必须选择")
                .setFieldstype("changedeptusercheck")
                .setData("receid")
                .setIsss(1)
        );

        addModuleFields(ModuleFields.get()
                .setName("参会人员ID")
                .setFields("receid")
                .setType("varchar(1000)")
                .setIslu(0).setIslb(0)
        );

        addModuleFields(ModuleFields.get()
                .setName("开始时间")
                .setFields("startdt")
                .setType("datetime")
                .setIsbt(1).setIspx(1)
                .setDevval("{now}")
                .setDev(null)
        );

        addModuleFields(ModuleFields.get()
                .setName("截止时间")
                .setFields("enddt")
                .setType("datetime")
                .setIsbt(1)
                .setDev(null)
        );

        addModuleFields(ModuleFields.get()
                .setName("会议介绍")
                .setFields("explain")
                .setType("varchar(1000)")
                .setPlaceholder("简单介绍会议内容")
                .setIsbt(0)
                .setIslb(0)
                .setLens(1000)
                .setFieldstype("textarea")
        );

        addModuleFields(ModuleFields.get()
                .setName("会议状态")
                .setFields("state")
                .setType("tinyint(1)")
                .setDev("0")
                .setIsss(1)
                .setIslu(0)
                .setIslb(1)
                .setData("0|正常|green,1|会议中|blue,2|结束|#ff6600,3|取消|#888888")
        );

        addModuleFields(ModuleFields.get()
                .setName("单位用户ID")
                .setFields("aid").setDev("0")
                .setType("int(11)").setNotelement(1)
        );

        addModuleFields(ModuleFields.get()
                .setName("对应单位")
                .setFields("cid").setDev("0")
                .setType("int(11)").setNotelement(1)
        );

        this.addfields("cid", "KEY", "`cid`", "对应单位ID");
        this.addfields("aid", "KEY", "`aid`", "单位用户ID");


        this.addWhere(ModuleWhere.get()
                .setNum("mytoday")
                .setName("我今日会议")
                .setWhere("{receidnot}")
        );

        this.addWhere(ModuleWhere.get()
                .setNum("myall")
                .setName("我参加所有会议")
                .setWhere("{receidnot}")
        );

        this.addWhere(ModuleWhere.get()
                .setNum("mycj")
                .setName("我创建的")
                .setWhere("`aid`={aid}")
                .setWtype(FlowWhere.WTYPE_EDIT)
        );

        this.addWhere(ModuleWhere.get()
                .setNum("mydel")
                .setName("自己创建可删")
                .setWhere("`aid`={aid}")
                .setWtype(FlowWhere.WTYPE_DEL)
                .setIslb(0)
        );

        //添加单据通知设置
        this.addFlowTodo(ModuleTodo.get("todo")
                .setName("会议通知")
                .setSummary(summary)
                .setWherelx("my")
                .setWherena("我参加的会议")
                .setActtype("turn,edit,finish")
                .setTofields("receid")
        );
    }

}
